package com.duobaoyu.dby.supply.biz.strategy.prewarning;

import com.duobaoyu.dby.channel.adapter.enums.biz.config.PreWarningConfigTypeEnum;
import com.duobaoyu.dby.supply.biz.strategy.AbstractPreWarningCountStrategy;
import com.duobaoyu.dby.supply.common.biz.dto.config.PreWarningConditionDTO;
import com.duobaoyu.dby.supply.common.biz.dto.refund.AfterSaleApplyQueryDTO;
import com.duobaoyu.dby.supply.db.repository.refund.AfterSaleRepository;
import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @author chenms
 * @date 2023/8/16 3:19 PM
 */
@Component
@Slf4j
@RequiredArgsConstructor
public class AfterSalePreWarningCountStrategy extends AbstractPreWarningCountStrategy {

    private final AfterSaleRepository afterSaleRepository;


    @Override
    protected long count(PreWarningConditionDTO preWarningCondition) {
        AfterSaleApplyQueryDTO afterSaleApplyQuery = new AfterSaleApplyQueryDTO();
        afterSaleApplyQuery.setPreWarningCondition(preWarningCondition);
        return afterSaleRepository.afterSaleExportCount(afterSaleApplyQuery);
    }

    @Override
    protected Set<Integer> supportPreWarningTypes() {
        return Sets.newHashSet(PreWarningConfigTypeEnum.REVIEW_NOT_COMPLETED.getValue(),
                PreWarningConfigTypeEnum.UNAUDITED_AFTER_SALES.getValue(),
                PreWarningConfigTypeEnum.WAIT_FILL_BACK_ADDRESS.getValue(),
                PreWarningConfigTypeEnum.WAIT_REJECT_CONFIRM.getValue());
    }


}
